package com.fanhang.sample.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping(value = "/")
public class IndexController {

	@Value(value = "${app.name}")
	private String name;
	@Value(value = "${app.desc}")
	private String desc;

	@ResponseBody
	@RequestMapping(value = "/index", method = { RequestMethod.GET })
	public Object index() {
		Map<String, String> map = new HashMap<String, String>();
		map.put("name", name);
		map.put("desc", desc);
		return map.toString();
	}
}